<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../../print.css" type="text/css" media="print">
<meta content="IIterable,org.as3commons.collections.framework.IIterable,iterator" name="keywords">
<title>org.as3commons.collections.framework.IIterable</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'IIterable - AS3Commons Collections 1.3.2';
				var baseRef = '../../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">AS3Commons Collections 1.3.2</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../index-list.html')" href="../../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../../index.html?org/as3commons/collections/framework/IIterable.html&amp;org/as3commons/collections/framework/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Interface&nbsp;IIterable</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Interface IIterable"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">org.as3commons.collections.framework</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Interface</td><td class="classSignature">public interface IIterable</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Subinterfaces</td><td><a href="../framework/ICollection.html">ICollection</a></td>
</tr>
</table>
<p></p>
  Iterable data structure definition.
  
  <p><strong>Description</strong></p>
  
  <p>Any object implementing <code>IIterable</code> can be sequentially enumerated using an iterator.</p>
  
  <p>Any <code>IIterable</code> instance can then also be recursively iterated using an <code>IRecursiveIterator</code>
  implementation (<code>RecursiveIterator, RecursiveFilterIterator</code>) or convenient filtered using
  a filter iterator (<code>FilterIterator, RecursiveFilterIterator</code>).</p>
  
  <p><strong>Notes</strong></p>
  
  <p>The iterator obtained by the <code>iterator()</code> method returns always the actual item added
  to the data structure regardless of the specific internal storage such as Node, MapEntry
  and so on.</p>
  
  <p>The iterator of an <code>IIterable</code> instance returned by the <code>iterator()</code>
  method is always a basic <code>IIterator</code>. Subtypes of this interface may return here a
  specialised iterator with richer functionality (such as adding or removing of items during
  an iteration loop). It is then possible to downcast the returned iterator to the specialised
  iterator type.</p>
     
  <p id="link_IteratorDowncastExample"><strong>Iterator downcast example</strong></p>
  
  <a class="exampleCollapsed" href="#link_IteratorDowncastExample" onClick="toggleExample(this, 'IteratorDowncastExample');">Show example</a><br /><div id="IteratorDowncastExample" style='display:none'><div class='listing'><pre>package {
    import org.as3commons.collections.ArrayList;
    import org.as3commons.collections.framework.ICollectionIterator;
    import org.as3commons.collections.framework.IIterator;
    import org.as3commons.collections.framework.IListIterator;
    import org.as3commons.collections.framework.IOrderedList;
    import org.as3commons.collections.framework.IOrderedListIterator;
    import flash.display.Sprite;

    public class IteratorDowncastExample extends Sprite {

        public function IteratorDowncastExample() {
            var list : IOrderedList = new ArrayList();
            var i : IIterator = list.iterator();
            
            trace ("i", i is IIterator); // true
            trace ("ci", i is ICollectionIterator); // true
            trace ("li", i is IListIterator); // true
            trace ("ali", i is IOrderedListIterator); // true
            
            var ci : ICollectionIterator = list.iterator() as ICollectionIterator;

            trace ("i", ci is IIterator); // true
            trace ("ci", ci is ICollectionIterator); // true
            trace ("li", ci is IListIterator); // true
            trace ("ali", ci is IOrderedListIterator); // true

            var li : IListIterator = list.iterator() as IListIterator;

            trace ("i", li is IIterator); // true
            trace ("ci", li is ICollectionIterator); // true
            trace ("li", li is IListIterator); // true
            trace ("ali", li is IOrderedListIterator); // true

            var ali : IOrderedListIterator = list.iterator() as IOrderedListIterator;

            trace ("i", ali is IIterator); // true
            trace ("ci", ali is ICollectionIterator); // true
            trace ("li", ali is IListIterator); // true
            trace ("ali", ali is IOrderedListIterator); // true
        }
    }
}
</pre></div></div>
  
  <p></p>
<p>
<span class="classHeaderTableLabel">See also</span>
</p>
<div class="seeAlso">
<a href="../iterators/RecursiveIterator.html" target="">RecursiveIterator - Recursive iterator usage example.</a>
<br>
<a href="../iterators/RecursiveFilterIterator.html" target="">RecursiveFilterIterator - Recursive filter iterator usage example.</a>
<br>
<a href="../iterators/FilterIterator.html" target="">FilterIterator - Filter iterator usage example.</a>
</div>
<br>
<hr>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#iterator()">iterator</a>(cursor:*):<a href="../framework/IIterator.html">IIterator</a>
</div>
<div class="summaryTableDescription">
   Returns an iterator over the iterable data structure.</div>
</td><td class="summaryTableOwnerCol">IIterable</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="iterator()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">iterator</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function iterator(cursor:*):<a href="../framework/IIterator.html">IIterator</a></code><p>
   Returns an iterator over the iterable data structure.
   
   </p><p>The <code>cursor</code> parameter is optional and not considered by all iterable
   data structures. E.g. the iterator of an unordered collection such as <code>Map</code>
   or <code>Set</code> starts always with the first item found. Still passing a parameter to
   such a data structure does not throw an error and will simply show no effect.</p>
   
   <p>The type of the cursor is unspecified and depends on the particular data structure.
   E.g. lists allow to specify an index, sets to specify an item and maps to specify a key.</p>
   
   <p>If <code>cursor</code> is specified, the iterator returns the item that is related
   to that cursor with the first call to <code>next()</code> (and its predecessor with
   the first call to <code>previous()</code> if the iterator allows bidirectional
   navigation.</p>
   
   <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">cursor</span>:*</code> &mdash; The initial cursor position.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../framework/IIterator.html">IIterator</a></code> &mdash; 
                        An iterator.
   
                        
                     </td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
